home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / examples / tgef.adb < prev    next >
Text File  |  1996-01-30  |  1KB  |  42 lines

  1. --  tgef.adb
  2. --  a simple test to instantiate GEF and call the sin function.
  3.  
  4. with Ada.Numerics.Generic_Elementary_Functions;
  5. with Ada.Numerics; use Ada.Numerics;
  6. with Text_IO;
  7. procedure Tgef is
  8.    package Flt_Io is new Text_IO.Float_Io (Float);
  9.  
  10.    package Elementary_Functions is new
  11.                   Ada.Numerics.Generic_Elementary_Functions (Float);
  12.    C : Character;
  13.    Y : Float;
  14.    P : Integer;
  15.    subtype Line is String (1 .. 80);
  16.    Filler  : Line := (others => ' ');
  17.    Display : array (0 .. 21) of Line;
  18. begin
  19.    Text_IO.Set_Page_Length (Text_IO.Current_Output, 0);
  20.  
  21.    for I in Display'range loop
  22.       Display (I) := Filler;
  23.    end loop;
  24.  
  25.    Display (10) := (1 .. 80 => '-');
  26.  
  27.    for I in 1 .. 20 loop
  28.       Y := Elementary_Functions.Sin (Float (I) * Pi / 10.0);
  29.       Flt_Io.Put (Y);
  30.       Text_IO.Put (" <==");
  31.       Text_IO.Put_Line (Integer'Image (I));
  32.       P := Integer (10.0 * Y) + 10;
  33.       Display (P)(4 * I) := '*';
  34.    end loop;
  35.  
  36.    for I in  Display'range loop
  37.       Text_IO.Put_Line (Display (I));
  38.    end loop;
  39.  
  40.    Text_IO.Put_Line ("Tgef exiting");
  41. end Tgef;
  42.